package com.its.cloud.dao;

import com.its.cloud.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author huguangjun
 * @className OrderMapper
 * @date 2021/1/17
 * @desc 16:21
 */
@Mapper
public interface OrderMapper {

    // 1新建订单
    @Insert("insert into t_order(user_id,product_id,count,money,status) values(#{userId},#{productId},#{count},#{money},0)")
    void create(Order order);

    // 2修改订单状态，从0改成1
    @Update("update t_order set status='1' where user_id = #{userId} and status = #{status}")
    void update(@Param("userId") Long userId, @Param("status") Integer status);
}
